﻿namespace ConsoleApp1.demo;

public class DataType {
    public static void TestDataType()
    {
        Console.WriteLine("Size of int: {0}", sizeof(int));
    }

    public static void testRefer()
    {
        int val = 8;
        object obj = val;//先装箱
        
        Console.WriteLine(obj.GetType());
        
        int nval = (int)obj;//再拆箱
        
        Console.WriteLine("nval: {0}", nval);
    }

    public static void testDynamic()
    {
        // 此处语法类似var
        dynamic val = 8;
        Console.WriteLine(val);
    }

    public static void testString()
    {
        String str = "hello world\\";
        Console.WriteLine(str);

        dynamic str2 = @"hello world\\";
        Console.WriteLine(str2);
        
        // 类似'''，但内部仍需对"进行双"转义
        string str3 = @"<script type=""text/javascript"">
    <!--     -->
    </script>";
        Console.WriteLine(str3);
    }

    public static void testPointer()
    {
        // 指针测试，暂不展开
    }
}